package com.punai.config.service.impl;

import com.punai.common.core.domain.TreeBo;
import com.punai.config.domain.EngineerLinkTemplate;
import com.punai.config.service.ConfigEngineerClassService;
import com.punai.config.sqlitedao.ConfigEngineerClassRepository;
import com.punai.config.sqlitedomain.ConfigEngineerClass;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ConfigEngineerClassServiceImpl implements ConfigEngineerClassService {

    @Autowired
    private ConfigEngineerClassRepository configEngineerClassRepository;

    @Override
    public List<ConfigEngineerClass> treelist() {
        return configEngineerClassRepository.findByPidNull();
    }

    @Override
    public void addOrUpdate(ConfigEngineerClass configEngineerClass) {
        configEngineerClassRepository.save(configEngineerClass);
    }

    @Override
    public void delete(String id) {
        configEngineerClassRepository.del(id);
    }

    @Override
    public ConfigEngineerClass getInfo(String id) {
        return configEngineerClassRepository.findOne(id);
    }

    @Override
    public List<EngineerLinkTemplate> getLinkTemplateEngineer(String code) {
        return configEngineerClassRepository.getLinkTemplateEngineer(code);
    }


}
